<?php

/**
 * ErrorController - The default error controller class
 * 
 * @author
 * @version 
 */

class ErrorController extends Zend_Controller_Action
{

	/**
	 * This action handles  
	 *	- Application errors
	 *	- Errors in the controller chain arising from missing 
	 *	  controller classes and/or action methods
	 */
	public function errorAction()
	{
		$errors = $this->_getParam('error_handler');
		switch ($errors->type) {
			case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
			case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: // Zend_Controller_Action_Exception
				//try and handle with Genome, else send to 404?
				
				
				// 404 error -- controller or action not found				
				$this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found');
				$this->view->title = 'HTTP/1.1 404 Not Found';
				break;
			default:
var_dump(Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER);
var_dump(Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION);
var_dump($errors);
				// application error; display error page, but don't change				
				// status code
				$this->view->title = 'Application Error';
				break;
		}
		
		$this->view->message = $errors->exception;
	}
}
?>